# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Compute.V1.Model.UrlMapTest do
  @moduledoc """
  Message for the expected URL mappings.

  ## Attributes

  *   `description` (*type:* `String.t`, *default:* `nil`) - Description of this test case.
  *   `expectedOutputUrl` (*type:* `String.t`, *default:* `nil`) - The expected output URL evaluated by the load balancer containing the scheme, host, path and query parameters. For rules that forward requests to backends, the test passes only when expectedOutputUrl matches the request forwarded by the load balancer to backends. For rules with urlRewrite, the test verifies that the forwarded request matches hostRewrite and pathPrefixRewrite in the urlRewrite action. When service is specified, expectedOutputUrl`s scheme is ignored. For rules with urlRedirect, the test passes only if expectedOutputUrl matches the URL in the load balancer's redirect response. If urlRedirect specifies https_redirect, the test passes only if the scheme in expectedOutputUrl is also set to HTTPS. If urlRedirect specifies strip_query, the test passes only if expectedOutputUrl does not contain any query parameters. expectedOutputUrl is optional when service is specified.
  *   `expectedRedirectResponseCode` (*type:* `integer()`, *default:* `nil`) - For rules with urlRedirect, the test passes only if expectedRedirectResponseCode matches the HTTP status code in load balancer's redirect response. expectedRedirectResponseCode cannot be set when service is set.
  *   `headers` (*type:* `list(GoogleApi.Compute.V1.Model.UrlMapTestHeader.t)`, *default:* `nil`) - HTTP headers for this request. If headers contains a host header, then host must also match the header value.
  *   `host` (*type:* `String.t`, *default:* `nil`) - Host portion of the URL. If headers contains a host header, then host must also match the header value.
  *   `path` (*type:* `String.t`, *default:* `nil`) - Path portion of the URL.
  *   `service` (*type:* `String.t`, *default:* `nil`) - Expected BackendService or BackendBucket resource the given URL should be mapped to. The service field cannot be set if expectedRedirectResponseCode is set.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :description => String.t() | nil,
          :expectedOutputUrl => String.t() | nil,
          :expectedRedirectResponseCode => integer() | nil,
          :headers => list(GoogleApi.Compute.V1.Model.UrlMapTestHeader.t()) | nil,
          :host => String.t() | nil,
          :path => String.t() | nil,
          :service => String.t() | nil
        }

  field(:description)
  field(:expectedOutputUrl)
  field(:expectedRedirectResponseCode)
  field(:headers, as: GoogleApi.Compute.V1.Model.UrlMapTestHeader, type: :list)
  field(:host)
  field(:path)
  field(:service)
end

defimpl Poison.Decoder, for: GoogleApi.Compute.V1.Model.UrlMapTest do
  def decode(value, options) do
    GoogleApi.Compute.V1.Model.UrlMapTest.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Compute.V1.Model.UrlMapTest do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
